/**
 * Light-commons Project
 * http://light-commons.googlecode.com
 * Copyright (C) 2008 Jason Green
 * email: guileen@gmail.com
 *
 * License: Apache License 2.0 
 * (http://www.apache.org/licenses/LICENSE-2.0)
 *
 */
package org.lightmtv.request;

import java.util.Locale;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;


/**
 * 
 * @author gl
 * @since Jun 29, 2008
 */
public interface Request {
	/**
	 * 从服务器端的可用locale中获取最适合locale
	 * @param avariableLocles
	 * @return
	 */
	Locale getBestLocaleIn(Locale[] avariableLocales);
	Locale[] getLocales();
	String getMethod();
	String getReferer();
	String getContextPath();
	String getPath();
	Map<String,String> getParams();
	Map<String,FileUpload> getUploads();
	Map<String,String> getHeaders();
	String getHeader(String name);
	Cookie[] getCookies();
	HttpSession getSession();
	
	@Deprecated
	HttpServletRequest getServletRequest();
	/**
	 * 
	 * @param name
	 * @return
	 */
	String getParam(String name);
	/**
	 * get the value of specified name and type
	 * @param <T>
	 * @param name
	 * @param toClass
	 * @return
	 */
	<T> T getParam(String name,Class<T> toClass);
	/**
	 * get the value of specified name and type,if null return default value.
	 * someurl?max=30
	 * int max = getParam("max",100);
	 * 
	 * @param <T>
	 * @param name
	 * @param defaultValue
	 * @return
	 */
	<T> T getParam(String name,T defaultValue);
}
